<%--
  Created by IntelliJ IDEA.
  User: Feilong
  Date: 2018/8/12
  Time: 22:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript" src="../dist/jquery/jquery-1.8.3.js"></script>
<head>
    <title>书籍智能查询</title>
    <style type="text/css">
        #id-form-center{
            padding: 20px 40%;
        }
    </style>
</head>
<body>
<%--<-center">
    <s:form action="queryBook" method="POST">
        <s:textfield name="keywords" />
        <s:radio name="radioValue"
                 list="#{'bname':'书籍名11','bauthor':'作者22','bpress':'出版社33'}" listKey="key" listValue="value"/>
        <s:submit type="input" value="查询" name=""/>
        <s:reset value="重置"/>
    </s:form>
</div>--%>

<div id="id-form-center">
    <form name="queryBook" method="post">
        <input type="text" name="keywords"><br>
        <input type="radio" name="radioValue" value="bname" onclick="clickRadioValue('queryByBname')">书籍名1
        <input type="radio" name="radioValue" value="bauthor" onclick="clickRadioValue('queryByBauthor')">作者2
        <input type="radio" name="radioValue" value="bpress" onclick="clickRadioValue('queryByBpress')">出版社3<br>
        <input type="submit" value="提交">&nbsp;&nbsp;
        <input type="reset" value="重置">
    </form>
    <table id="id-table-queryResult">

    </table>
    <hr>

</div>

<tabe id="id-table-querybook">

</tabe>
</body>
</html>
<script type="text/javascript">
    var url2action;

    function clickRadioValue(value){
        queryBook.action='queryBook_'+value+'.action';
        url2action='queryBook_'+value+'.action';
        queryBook.submit();
    }
    $(function () {
        $("input[type=radio]").click(function () {
            $.ajax({
                type:'post',
                url:url2action,
                dataType:'json',
                success:function (data) {
                    console.log(data);

                }
            });
        });


    });
</script>
